﻿namespace AgileBoard.Domain
{
    using System;
    using SharpArch.Core.DomainModel;

    public class Role : Entity
    {
        public const int AdministratorId = 1;
        public const int DeveloperId = 3;
        public const int GuestId = 4;
        public const int LeadDeveloperId = 2;

        // allowed roles. These must match the data in table Role
        public static Role Administrator
        {
            get { return new Role {RoleID = AdministratorId, Name = "Manager"}; }
        }

        public static Role LeadDeveloper
        {
            get { return new Role {RoleID = LeadDeveloperId, Name = "Lead Developer"}; }
        }

        public static Role Developer
        {
            get { return new Role {RoleID = DeveloperId, Name = "Developer"}; }
        }

        public static Role Guest
        {
            get { return new Role {RoleID = GuestId, Name = "Guest"}; }
        }

        public virtual bool IsAdministrator
        {
            get { return Name == Administrator.Name; }
        }

        public virtual bool IsLeadDeveloper
        {
            get { return Name == LeadDeveloper.Name; }
        }

        public virtual bool IsDeveloper
        {
            get { return Name == Developer.Name; }
        }

        public virtual bool IsGuest
        {
            get { return Name == Guest.Name; }
        }

        /// <summary>
        /// Created Date
        /// </summary>
        public virtual DateTime CreateTime { get; set; }

        /// <summary>
        /// Created by
        /// </summary>
        public virtual string Creator { get; set; }


        /// <summary>
        /// Role GUID
        /// </summary>
        public virtual Guid RoleGUID { get; set; }

        /// <summary>
        /// Role id
        /// </summary>
        public virtual int RoleID { get; set; }


        /// <summary>
        /// Project name
        /// </summary>
        public virtual string Name { get; set; }

        public override string ToString()
        {
            return Name;
        }
    }
}